﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JSON;

namespace Facebook_Graph_Toolkit.FacebookObjects {
    /// <summary>
    /// Repesents a Facebook Application Test User
    /// </summary>
    public class TestUser {
        JsonObject data;
        internal TestUser(JsonObject JO) { data = JO; }
        /// <summary>
        /// User ID of Test User
        /// </summary>
        public string UserID { get { return (string)data["id"]; } }
        /// <summary>
        /// Access Token to be used to make API calls on behalf of the test user. Available only if app has been installed by test user.
        /// </summary>
        public string AccessToken { get { return (string)data["access_token"]; } }
        /// <summary>
        /// An url to login as the test user. Expires after an hour.
        /// </summary>
        public string LoginUrl { get { return (string)data["login_url"]; } }
        /// <summary>
        /// Email address to be used if logging in manually
        /// </summary>
        public string Email { get { return (string)data["email"]; } }
        /// <summary>
        /// Password to be used if logging in manually. The password should be stored as it is only returned on the creation of the test user.
        /// </summary>
        public string Password { get { return (string)data["password"]; } }

        /// <summary>
        /// Returns a string representation of the current Test User
        /// </summary>
        /// <returns></returns>
        public override string ToString() {
            return string.Format("UserID=\"{0}\"; AccessToken=\"{1}\"; LoginUrl=\"{2}\"; Email=\"{3}\"; Password=\"{4}\"", UserID, AccessToken, LoginUrl, Email, Password);
        }
    }
}
